jit.cellblock - This object provides a visual interface
to a 2-dimensional matrix of data, where each data point (or “cell”) can
contain any of the data types used in Max. The grid resembles a spreadsheet
from Microsoft's Excel.
The data can be changed, edited, and selected either by the user or by
the patch.
The jit.cellblock object fills a special need in Max - a space-efficient
display of Max values, with the ability to select or edit them visually
within the patch.
Structural messages and setup:
Many of the structural settings of the jit.cellblock are available for
programmatic control.
For instance, the “rows” and “cols” messages that are sent to jit.cellblock
control the number of rows and columns stored in the jit.cellblock.
“rowhead” and “colhead” messages changes the colour of the first row and
columns to be used as headers, for text or images.
“”grid" turns the grid on and off.
Opening inspector will display what attributes can be modified.
Storing and retrieving values:
The easiest way to select a cell is to click on it, like you would in
a spreadsheet. When you select a new cell, the coordinates are outputted
from the left outlet.
To program the control of the current selection, you can use the message
“select" with arguments that choose the column and row to select as well.
i.e. “select 0 4” will select row 0, column 4.
“set current” - when a cell is selected, this will take the incoming value
and change the current cell's value to this integer.
i.e. set current $1
“set x y" - This will change the cell in the row and column specified
to whatever the argument is after the message.
i.e. set x y “hello world”
“clear” - Will clear the cell selected
clear x y will clear a specified cell.
jit.cellblock is useful partly because it provides a large set of user
options for selecting and manipulating data in a cell. If you don't want
the user to be able to edit the values in the cells, you can set the jit.cellblock
object to “readonly 1” with a message.
Selection and output options:
In order to be as flexible as possible, jit.cellblock has several selection
and output modes. The selection mode (set with the “selmode” attribute)
defaults to selecting a single cell (known as “one cell select” mode.)
However, there are six different options for cell selection:
mode 0 - prevents any cell selection. Good if you want jit.cellblock to
act like a large set of labels.
mode 1 - single cell select
mode 2 - column select
mode 3 - object select
mode 4 - header select. This will select the entire headers if turned
on, but single cells for the rest.
mode 5 - in-place edit. Double-clicking on any cell will allow you to
edit or add information to the selected cell. This is more convenient than
using select and set messages, although cannot be controlled with your
patch.
For output modes, there are three different modes:
output 0 - Individual output mode. It will send each selected cell in
its own message, and will output a message for cells that may not have
any data value.
output 1 - Output as one list. It will combine all non-blank cell values
into a single list, and output it in a single message.
output 2 - Output as one symbol. It will combine all of the non-blank
cell values into a list, then turn the list into a single text symbol. This
is most useful if you have filled your jit.cellblock with textual values,
and want to combine them into larger phrases.